package tech.aistar.day01.ioc;

import java.util.List;

/**
 * 本类用来演示:
 *
 * @author: success
 * @date: 2021/5/6 1:33 下午
 */
public class User {
    private String name;

    private int age;

    private UserInfo userInfo;//依赖的对象

    private List<Car> carList;

    public void setUserInfo(UserInfo userInfo) {
        System.out.println("setUserInfo");
        this.userInfo = userInfo;
    }

    public void setCarList(List<Car> carList) {
        this.carList = carList;
    }

    public List<Car> getCarList() {
        return carList;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public User(){
        System.out.println("User()..");
    }
    public User(String name,int age){
        System.out.println("User()全参构造");
        this.name = name;
        this.age = age;
    }

    public void setName(String name) {
        System.out.println("setName...");
        this.name = name;
    }

    public void setAge(int age) {
        System.out.println("setAge...");
        this.age = age;
    }


    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("User{");
        sb.append("name='").append(name).append('\'');
        sb.append(", age=").append(age);
        sb.append('}');
        return sb.toString();
    }
}
